SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE  FUNCTION [dbo].[GetAssetDetailsByNAVDate]
(
	-- Add the parameters for the function here
	@NAVDate DATE , @AssetIntrnlId INT, @FundId VARCHAR(10)
	
	)
RETURNS     DECIMAL(38,10)
AS
BEGIN
	


	
	DECLARE @ShortNAVDate AS DATE = @NAVDate

	--GET PRIOR NAV DATE

	-- Add the T-SQL statements to compute the return value here

DECLARE @tmp AS decimal	(38,10)  =(

		
SELECT TOP 1
		a.AmortCostPctPar		

	
		
	 FROM FSFundModel.Reporting.Asset a 
	 INNER JOIN  FSFundModel.Reporting.Export e 
	 ON a.ExportId = e.ExportId 


		WHERE e.NAVDate = @NAVDate 
		AND e.FundId = @FundId
		AND a.AssetIntrnlId = @AssetIntrnlId


		)
		
		RETURN @tmp
        



END
GO
